<template lang="pug">
.back-mark(:style="styleObjectDefault" @click="back" v-if="$route.query.aerial")
  span 首页航拍
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      styleObjectDefault: {
        background: 'url(static/images/zz.png) no-repeat 100% 100%',
      },
    }
  },
  computed: {
    ...mapGetters(['panoInfo']),
  },
  methods: {
    // 返回航拍视角
    back() {
      // this.$store.dispatch('fetchOverviewLoadInfo', null)
      if (this.panoInfo && this.panoInfo.scene_aerial_list && this.panoInfo.scene_aerial_list.length > 0) {
        console.log('255555-----------')
        let groupList = this.panoInfo.scene_aerial_list
        let sceneId = ''
        for (let i in groupList) {
          if (groupList[i].is_aerial) {
            sceneId = groupList[i].scene_id
            break
          }
        }
        // console.log(sceneId)
        if (sceneId) {
          this.$krp.switchEffect(sceneId)
          // this.$vgo.emit('sync:scene', sceneId)
          this.$router.push('/panoview/' + this.$route.params.panoId)
          // setTimeout(() => {
          //   this.$router.push('/panoview/' + this.$route.params.panoId)
          // }, 1000)
        }
      } else {
        console.log('12-----')
        this.$router.push('/panoview/' + this.$route.params.panoId)
        setTimeout(() => {
          window.location.reload()
        }, 1500)
      }
    }
  }
}
</script>

<style lang="stylus">
.back-mark
  position absolute
  right 3%
  top 143px
  z-index 11
  width 12px
  font-size 12px
  height 80px
  cursor pointer
  text-align center
  padding 0 10px
  overflow hidden
  span
    width 12px
    display inline-block
    height 100%
    word-wrap break-word
    word-break break-all
    letter-spacing 3px
    color #fff
@media screen and (max-width: 768px) {
  .back-mark {
    top 100px
  }
}
</style>
